//package com.mediacloud.app.newsmodule.fragment.ws
//
//import android.graphics.Color
//import android.os.Bundle
//import android.text.TextUtils
//import android.view.View
//import android.view.ViewGroup
//import com.mediacloud.app.assembly.views.TimeLineRelativeLayout
//import com.mediacloud.app.model.fragment.BaseFragment
//import com.mediacloud.app.model.interfaces.DataInvokeCallBack
//import com.mediacloud.app.model.news.ArticleItem
//import com.mediacloud.app.model.news.ArticleListData
//import com.mediacloud.app.model.news.CatalogItem
//import com.mediacloud.app.newsmodule.R
//import com.mediacloud.app.newsmodule.adaptor.NewsListItemStyleAdaptor
//import com.mediacloud.app.newsmodule.fragment.video.vod.PlayClickListener
//import com.mediacloud.app.newsmodule.utils.NewsItemClickUtils
//import com.mediacloud.app.newsmodule.utils.NewsListDataInvoker
//import com.scwang.smartrefresh.layout.api.RefreshLayout
//import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
//import kotlinx.android.synthetic.main.ws24_list_fragment.*
//
//class WS24ListFragment : BaseFragment(), DataInvokeCallBack<ArticleListData>, PlayClickListener, OnLoadMoreListener {
//    companion object {
//        fun newInstance(id: String, catalog: CatalogItem? = null): WS24ListFragment {
//            val f = WS24ListFragment()
//            val b = Bundle()
//            b.putString("NAV_ID", id)
//            catalog?.let {
//                b.putParcelable("CATALOG", catalog)
//            }
//            f.arguments = b
//            return f
//        }
//    }
//
//    var publish_date_start: String? = null
//    var publish_date_end: String? = null
//    var refreshLayout: RefreshLayout? = null
//    var dataInvoker: NewsListDataInvoker? = null
//    var adapter: NewsListItemStyleAdaptor? = null
//    protected var pageNum = 1
//    protected var pageSize = 10
//    var catalogID: String? = ""
//    var catalog: CatalogItem? = null
//    override fun getLayoutResID(): Int {
//        return R.layout.ws24_list_fragment
//    }
//
//    fun refresh(publish_date_start: String?, publish_date_end: String?) {
//        this.publish_date_start = publish_date_start
//        this.publish_date_end = publish_date_end
//        pageNum = 1
//        getNewsListData()
//    }
//
//    override fun initView() {
//         catalogID = arguments?.getString("NAV_ID")
//        catalog = arguments?.getParcelable("CATALOG")
//        mCatalogContentItemListView.setTag(R.id.timeLineColor, Color.WHITE)
//        mCatalogContentItemListView.setTag(R.id.isFromTimeLineNav, true)
//        mCatalogContentItemListView.setTag(R.id.isFROM92, true)
//        adapter = NewsListItemStyleAdaptor(requireContext(), this)
//        adapter?.catalogItem = catalog
//        dataInvoker = NewsListDataInvoker(this)
//        mCatalogContentItemListView.adapter = adapter
//        getNewsListData()
//        mCatalogContentItemListView.setOnItemClickListener { parent, view, position, id ->
//
//            val item = adapter?.getItem(position)
//            item?.let {
//                item.parentId = catalogID
//                NewsItemClickUtils.OpenItemNewsHandle(requireContext(), item.getType(), item, catalog ?: CatalogItem())
//            }
//
//        }
//
//    }
//
//    fun getNewsListData() {
//        val map:MutableMap<String,String> = HashMap()
//        map["only_article"]="1"
//        if(!TextUtils.isEmpty(publish_date_start)){
//            map["publish_date_start"] = "$publish_date_start"
//        }
//        if(!TextUtils.isEmpty(publish_date_end)){
//            map["publish_date_end"] = "$publish_date_end"
//        }
//        dataInvoker?.getContentList(catalogID,pageNum,pageSize,map)
//    }
//
//    override fun success(data: ArticleListData?) {
//        refreshLayout?.finishLoadMore()
//        data?.let {
//            if (pageNum == 1) {
//                adapter?.listContentData?.clear()
//                if (it.articleList.isNotEmpty()) {
//                    TimeLineRelativeLayout.headList.add("${it.articleList[0].id}")
//                }
//            }
//            if (adapter?.listContentData == null) {
//                adapter?.listContentData = it.articleList
//            } else {
//                adapter?.listContentData?.addAll(it.articleList)
//            }
//            adapter?.notifyDataSetChanged()
//        }
//
//    }
//
//    override fun fault(data: Any?) {
//        if (pageNum == 1) {
//            adapter?.listContentData?.clear()
//            adapter?.notifyDataSetChanged()
//        }
//        refreshLayout?.finishLoadMore()
//    }
//
//    override fun onPlayIcoClick(rootView: View?, container: ViewGroup?,  playIcon:View?,item: ArticleItem?) {
//
//    }
//
//    override fun onLoadMore(refreshLayout: RefreshLayout) {
//        this.refreshLayout = refreshLayout
//        pageNum++
//        getNewsListData()
//    }
//}